<!doctype html>
<html>
{include file="head.html"}

<body>


<div class="fullscreen">
  <div class="scroll_content">
    <div class="topfixed">
      <div class="t_left"><a href="/index.php"><i class="back"></i></a></div>
      <div class="t_main">校区选择</div>
      <a href="/index.php" class="link">{$site.sitename}</a>
    </div>
    <div class="paddingheight"></div>
    <div class="chooseSchool_search">
      <input type="text" placeholder="请输入学校名称" id="keyword" class="inp">
      <input type="button" id="search-btn" class="btn">
    </div>
    <div class="chooseSchool_position"> </div>
    <div class="chooseSchool_search_position"><i class="ico"></i>离你最近的大学：<span id="nearSite">定位中</span></div>
    <div class="choose_city_div_box">
      <div class="choose_city_div">
         {foreach item=c key=k from=$citys}
        <div class="city {if $k eq 0}active{/if}" to="city{$c.id}">{$c.title}</div>
        {/foreach}
      </div>
    </div>
    <div class="choose_zone_list_box">
    <div class="choose_zone_list">
        {foreach item=c key=k from=$citys}
        <div class="citys {if $k neq 0}none{/if}" id="city{$c.id}">
        {if $c.child}
        {foreach item=cc from=$c.child}
          
          <div class="zone_tt">{$cc.title}</div>
          
          <div class="site_list"> 
          {if $cc.sites}
          {foreach item=s from=$cc.sites}
          <a href="/index.php?siteid={$s.siteid}">
            <div class="site">{$s.sitename}</div>
            </a>
            {/foreach}
            {/if}
            </div>
          
          {/foreach}  
          {/if}
          </div>
          {/foreach}  
           
     
    </div>
    
    </div>
  </div>
</div>




  
 
 <style>
    	.search_result{position:absolute;  top:90px; right:0px; left:0px; background-color:#fff; padding:10px; display:none}
		.search_result .item{line-height:30px; height:30px;}
    </style>
<div class="search_result" id="search_result">
    	<div class="item"></div>
    </div>
 {include file="footer.html"}
 <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak={const.BDMAPKEY}"></script> 
 <script>
 $(function(){
	 $(document).on("click",".city",function(){
		$(".city").removeClass("active");
		$(this).addClass("active");
		$(".citys").addClass("none");
		$("#"+$(this).attr("to")).removeClass("none"); 
	 });
	 var word="";
	 $("#search-btn").on("click",function(){
		  
			  
			 $.get("/index.php?m=sites&a=search&ajax=1",{keyword:$("#keyword").val()},function(data){
				 if(data.error){
					 $("#search_result").html("");
				 }else{
					 var html="";
					 for(var i=0;i<data.data.length;i++){
						html=html+'<div class="item" siteid="'+data.data[i].siteid+'">'+data.data[i].sitename+'</div>'; 
					 }
					 $("#search_result").html(html).show();
				 }
			 },"json");
		  
	 });
	 $(document).on("click","#search_result .item",function(data){
		 window.location="/index.php?siteid="+$(this).attr("siteid");
	 })
	 $(".fullscreen").click(function(){
		  $("#search_result").hide();
	 });
	var lat,lng;
	var geolocation = new BMap.Geolocation();
	 
		geolocation.getCurrentPosition(function(r){
		if(this.getStatus() == BMAP_STATUS_SUCCESS){
			lat=r.point.lat;
			lng=r.point.lng;
			$.get("/index.php?m=sites&a=near&ajax=1",{lat:lat,lng:lng},function(data){
				if(data.error==0){
					$("#nearSite").html('<a href="/index.php?siteid='+data.data.siteid+'">'+data.data.sitename+'</a>');
				}
			},"json")
		}
		else {
			skyToast('获取位置失败'+this.getStatus());
		}        
	},{enableHighAccuracy: true})
		
	 
 })
 
 </script>
</body>
</html>
